how to optimize your ecommerce website with JavaScript